package com.mfin.bom.objects;

// Generated 17 Jun, 2012 11:27:33 PM by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.mfin.enumeration.UserRole;

/**
 * User generated by hbm2java
 */
@Entity
@Table(name = "user", catalog = "mfindb")
public class User implements java.io.Serializable {

	private String id;
	private Finance finance;
	private String password;
	private UserRole role;
	private Set<Cashbook> cashbooks = new HashSet<Cashbook>(0);

	public User() {
	}

	public User(String id) {
		this.id = id;
	}

	public User(String id, Finance finance, String password, UserRole role,
			Set<Cashbook> cashbooks) {
		this.id = id;
		this.finance = finance;
		this.password = password;
		this.role = role;
		this.cashbooks = cashbooks;
	}

	@Id
	@Column(name = "ID", unique = true, nullable = false, length = 50)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "FINANCE_ID")
	public Finance getFinance() {
		return this.finance;
	}

	public void setFinance(Finance finance) {
		this.finance = finance;
	}

	@Column(name = "PASSWORD", length = 50)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "ROLE", length = 50)
	@Enumerated(EnumType.STRING)
	public UserRole getRole() {
		return this.role;
	}

	public void setRole(UserRole role) {
		this.role = role;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Cashbook> getCashbooks() {
		return this.cashbooks;
	}

	public void setCashbooks(Set<Cashbook> cashbooks) {
		this.cashbooks = cashbooks;
	}

}
